<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>字面量创建正则表达式</title>
</head>
<body>
    <script>
        let hd = 'houdunren.com';
        // 判断hd中是否有u
        console.log(/u/.test(hd));

        // 正则表达式中放一个变量
        let a = 'u';
        console.log(eval(`/${a}/`).test(hd));
    </script>
</body>
</html>